package Entity

import "time"

type MapEntity struct {
	BaseEntity
	Name            string    `json:"name"`
	Introduction    string    `json:"introduction"`
	Url             string    `json:"url"`
	MapType         byte      `json:"mapType"`
	MediumType      byte      `json:"mediumType"`
	PublicationTime time.Time `json:"publicationTime"`
	CollectionTime  time.Time `json:"collectionTime"`
}

func (this *MapEntity) Update(that *MapEntity) {
	if that.Name != "" {
		this.Name = that.Name
	}
	if that.Introduction != "" {
		this.Introduction = that.Introduction
	}
	if that.Url != "" {
		this.Url = that.Url
	}
	if that.MapType != 0 {
		this.MapType = that.MapType
	}
	if that.MediumType != 0 {
		this.MediumType = that.MediumType
	}
	if !that.PublicationTime.IsZero() {
		this.PublicationTime = that.PublicationTime
	}
	if !that.CollectionTime.IsZero() {
		this.CollectionTime = that.CollectionTime
	}
}
